package webmarket.controller.transferobjects;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import webmarket.common.XmlBase;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class JQueryDataTableParamModel extends XmlBase {
	private static final long serialVersionUID = 235682320650734256L;

	/**
	 * Request sequence number sent by DataTable, same value must be returned in
	 * response
	 */
	public String sEcho;

	/**
	 * Text used for filtering
	 */
	public String sSearch;

	/**
	 * Number of records that should be shown in table
	 */
	public int iDisplayLength;

	/**
	 * First record that should be shown(used for paging)
	 */
	public int iDisplayStart;

	/**
	 * Number of columns in table
	 */
	public int iColumns;

	/**
	 * Number of columns that are used in sorting
	 */
	public int iSortingCols;

	/**
	 * Index of the column that is used for sorting
	 */
	public int iSortColumnIndex;

	/**
	 * Sorting direction "asc" or "desc"
	 */
	public String sSortDirection;

	/**
	 * Comma separated list of column names
	 */
	public String sColumns;

	public String[] getColumns() {
		return sColumns.split(",");
	}

	public String getSortColumnName() {
		return getColumns()[iSortColumnIndex];
	}
}
